<?php 

function kirki_companyinfo()
{
    
Kirki::add_section( 'companyinfo', array(
    'priority'    => 1,
    'title'       => esc_html__( '公司信息', 'ifan_theme' ),
    'panel'       => 'options',
) );

Kirki::add_field( 'ifan_theme_config', [
    'type'     => 'text',
    'settings' => 'companyinfo-fullname',
    'label'    => esc_html__( '公司全称', 'ifan_theme' ),
    'section'  => 'companyinfo',
    'default'  => esc_html__( '爱范主题之-公司全称', 'ifan_theme' ),
    'priority' => 2,
    'partial_refresh'    => [
        'companyinfo-fullname-text' => [
            'selector'        => '#companyinfo-fullname',
            'render_callback' => function() {
                // return Kirki::get_option('biglogo_img_url');
                return  Kirki::get_option('companyinfo','companyinfo-fullname');
            },
        ],

    ],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'     => 'text',
    'settings' => 'companyinfo-shortname',
    'label'    => esc_html__( '公司简称', 'ifan_theme' ),
    'section'  => 'companyinfo',
    'default'  => esc_html__( '爱范主题之-公司简称', 'ifan_theme' ),
    'priority' => 3,
    'partial_refresh'    => [
        'companyinfo-shortname-text' => [
            'selector'        => '#companyinfo-shortname',
            'render_callback' => 'wp_get_document_title',

        ],

    ],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'     => 'text',
    'settings' => 'companyinfo-address',
    'label'    => esc_html__( '公司地址', 'ifan_theme' ),
    'section'  => 'companyinfo',
    'default'  => esc_html__( '爱范主题之-公司地址', 'ifan_theme' ),
    'priority' => 4,
    'partial_refresh'    => [
        'companyinfo-address-text' => [
            'selector'        => '#companyinfo-address',
            'render_callback' => function() {
                return  Kirki::get_option('companyinfo','companyinfo-address');
            },
        ],

    ],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'     => 'text',
    'settings' => 'companyinfo-zipcode',
    'label'    => esc_html__( '公司邮编', 'ifan_theme' ),
    'section'  => 'companyinfo',
    'default'  => esc_html__( '爱范主题之-公司邮编', 'ifan_theme' ),
    'priority' => 5,
    'partial_refresh'    => [
        'companyinfo-zipcode-text' => [
            'selector'        => '#companyinfo-zipcode',
            'render_callback' => function() {
                return  Kirki::get_option('companyinfo','companyinfo-zipcode');
            },
        ],

    ],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'     => 'text',
    'settings' => 'companyinfo-linkman',
    'label'    => esc_html__( '公司联系人', 'ifan_theme' ),
    'section'  => 'companyinfo',
    'default'  => esc_html__( '爱范主题之-公司联系人', 'ifan_theme' ),
    'priority' => 6,
    'partial_refresh'    => [
        'companyinfo-linkman-text' => [
            'selector'        => '#companyinfo-linkman',
            'render_callback' => function() {
                return  Kirki::get_option('companyinfo','companyinfo-linkman');
            },
        ],

    ],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'     => 'text',
    'settings' => 'companyinfo-linkmanmobile',
    'label'    => esc_html__( '公司联系人手机', 'ifan_theme' ),
    'section'  => 'companyinfo',
    'default'  => esc_html__( '爱范主题之-公司联系人手机', 'ifan_theme' ),
    'priority' => 7,
    'partial_refresh'    => [
        'companyinfo-linkmanmobile-text' => [
            'selector'        => '#companyinfo-linkmanmobile',
            'render_callback' => function() {
                return  Kirki::get_option('companyinfo','companyinfo-linkmanmobile');
            },
        ],

    ],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'     => 'text',
    'settings' => 'companyinfo-tel',
    'label'    => esc_html__( '公司电话', 'ifan_theme' ),
    'section'  => 'companyinfo',
    'default'  => esc_html__( '爱范主题之-公司电话', 'ifan_theme' ),
    'priority' => 8,
    'partial_refresh'    => [
        'companyinfo-tel-text' => [
            'selector'        => '#companyinfo-tel',
            'render_callback' => function() {
                return  Kirki::get_option('companyinfo','companyinfo-tel');
            },
        ],

    ],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'     => 'text',
    'settings' => 'companyinfo-tax',
    'label'    => esc_html__( '公司传真', 'ifan_theme' ),
    'section'  => 'companyinfo',
    'default'  => esc_html__( '爱范主题之-公司传真', 'ifan_theme' ),
    'priority' => 9,
    'partial_refresh'    => [
        'companyinfo-tax-text' => [
            'selector'        => '#companyinfo-tax',
            'render_callback' => function() {
                return  Kirki::get_option('companyinfo','companyinfo-tax');
            },
        ],

    ],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'     => 'text',
    'settings' => 'companyinfo-qq',
    'label'    => esc_html__( '公司QQ', 'ifan_theme' ),
    'section'  => 'companyinfo',
    'default'  => esc_html__( '爱范主题之-公司QQ', 'ifan_theme' ),
    'priority' => 10,
    'partial_refresh'    => [
        'companyinfo-qq-text' => [
            'selector'        => '#companyinfo-qq',
            'render_callback' => function() {
                return  Kirki::get_option('companyinfo','companyinfo-qq');
            },
        ],

    ],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'     => 'text',
    'settings' => 'companyinfo-email',
    'label'    => esc_html__( '公司邮箱', 'ifan_theme' ),
    'section'  => 'companyinfo',
    'default'  => esc_html__( '爱范主题之-公司邮箱', 'ifan_theme' ),
    'priority' => 11,
    'partial_refresh'    => [
        'companyinfo-email-text' => [
            'selector'        => '#companyinfo-email',
            'render_callback' => function() {
                return  Kirki::get_option('companyinfo','companyinfo-email');
            },
        ],

    ],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'     => 'text',
    'settings' => 'companyinfo-copyright',
    'label'    => esc_html__( '公司版权信息', 'ifan_theme' ),
    'section'  => 'companyinfo',
    'default'  => esc_html__( '爱范主题之-公司版权信息', 'ifan_theme' ),
    'priority' => 12,
    'partial_refresh'    => [
        'companyinfo-copyright-text' => [
            'selector'        => '#companyinfo-copyright',
            'render_callback' => function() {
                return  Kirki::get_option('companyinfo','companyinfo-copyright');
            },
        ],

    ],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'     => 'text',
    'settings' => 'companyinfo-beianhao',
    'label'    => esc_html__( '公司备案号', 'ifan_theme' ),
    'section'  => 'companyinfo',
    'default'  => esc_html__( '爱范主题之-公司备案号', 'ifan_theme' ),
    'priority' => 13,
    'partial_refresh'    => [
        'companyinfo-beianhao-text' => [
            'selector'        => '#companyinfo-beianhao',
            'render_callback' => function() {
                return  Kirki::get_option('companyinfo','companyinfo-beianhao');
            },
        ],

    ],
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'     => 'text',
    'settings' => 'companyinfo-wxnum',
    'label'    => esc_html__( '公司微信号', 'ifan_theme' ),
    'section'  => 'companyinfo',
    'default'  => esc_html__( '爱范主题之-公司微信号', 'ifan_theme' ),
    'priority' => 14,
    'partial_refresh'    => [
        'companyinfo-wxnum-text' => [
            'selector'        => '#companyinfo-wxnum',
            'render_callback' => function() {
                return  Kirki::get_option('companyinfo','companyinfo-wxnum');
            },
        ],

    ],
] );


Kirki::add_field( 'ifan_theme_config', [
    'type'        => 'image',
    'settings'    => 'companyinfo-wximg',
    'label'       => esc_html__( '公司微信二维码', 'ifan_theme' ),

    'section'     => 'companyinfo',
    'default'     => get_template_directory_uri().'/style/images/logo1.png',
    'priority' => 15,
    'partial_refresh'    => [
        'companyinfo-wximg' => [
            'selector'        => '#companyinfo-wximg',
            'render_callback' => function() {

                return '<img src="'.Kirki::get_option('companyinfo-wximg').'" alt="二维码" >';
            },
        ],

    ],
    
] );

Kirki::add_field( 'ifan_theme_config', [
    'type'        => 'sortable',
    'settings'    => 'sortable_setting',
    'label'       => esc_html__( 'This is the label', 'kirki' ),
    'section'     => 'companyinfo',
    'default'     => [
        'option3',
        'option1',
        'option4'
    ],
    'choices'     => [
        'option1' => esc_html__( 'Option 1', 'kirki' ),
        'option2' => esc_html__( 'Option 2', 'kirki' ),
        'option3' => esc_html__( 'Option 3', 'kirki' ),
        'option4' => esc_html__( 'Option 4', 'kirki' ),
        'option5' => esc_html__( 'Option 5', 'kirki' ),
        'option6' => esc_html__( 'Option 6', 'kirki' ),
    ],
    'priority'    => 10,
] );
Kirki::add_field( 'ifan_theme_config', [
    'type'        => 'repeater',
    'label'       => esc_attr__( '百度地图信息', 'ifan_theme' ),
    'section'     => 'companyinfo',
    'priority'    => 90,
    'row_label' => [
        'type'  => 'field',
        'value' => esc_html__( '百度地图坐标.', 'ifan_theme' ),
        'field' => 'link_text',
    ],
    'settings'    => 'companyinfo-baidumap',
    'button_label' => esc_html__('"点击" 添加公司坐标 ', 'ifan_theme' ),
    'fields' => [
        'mapx' => [
            'type'        => 'text',
            'label'       => esc_html__( '经度', 'ifan_theme' ),
            'description' => '<a href="'.get_template_directory_uri().'/baidu.html" target="_blank">自动百度经纬度</a>或者<a href="http://api.map.baidu.com/lbsapi/getpoint/index.html" target="_blank">手动百度经纬度</a>',
            'default'     => '',
        ],
        'mapy' => [
            'type'        => 'text',
            'label'       => esc_html__( '纬度', 'ifan_theme' ),
            'default'     => '',
        ],
        'mapz' => [
            'type'        => 'text',
            'label'       => esc_html__( '缩放级别', 'ifan_theme' ),
            'description' => esc_html__( '缩放级别为1表示世界地图,级别越大越精确', 'ifan_theme' ),
            'default'     => '11',
        ],
    ],
    
    'choices' => [
        'limit' => 1
    ],
] );
}

 ?>